package com.gxa.community.admin.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

//@Configuration
public class MvcConfig implements WebMvcConfigurer {
    @Override
    public void addCorsMappings(CorsRegistry registry) {
        registry
                .addMapping("/**")
                .allowCredentials(true)
                .allowCredentials(true)
                .allowedMethods(new String[]{"GET", "POST", "PUT", "DELETE","OPTIONS"})
                .allowedOrigins("*")
                .allowedHeaders("*");
    }
//    @Bean
//    public RequestInterceptor getRequestInterceptor(){
//        return new RequestInterceptor();
//    }
//
//    @Override
//    public void addInterceptors(InterceptorRegistry registry){
//        registry.addInterceptor(getRequestInterceptor()).addPathPatterns("/**");  // token 验证拦截器,注册spring 容器中的拦截器对象
//    }
}
